package com.aube.plugin.episode.list;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by huyaonan on 16/6/14.
 */
public class CustomRecyclerView extends RecyclerView {
    public CustomRecyclerView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public CustomRecyclerView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CustomRecyclerView(Context context) {
        this(context, null);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if(ev.getAction() == MotionEvent.ACTION_DOWN)
            if(iCallback != null)
                iCallback.end();
        return super.dispatchTouchEvent(ev);
    }

    public interface IAutoAnimEndCallback {
        public void end();
    }

    private IAutoAnimEndCallback iCallback;

    public void setITimerResetCallback(IAutoAnimEndCallback callback) {
        this.iCallback = callback;
    }

}
